home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / pp / pp-6.0 / Lib / addr / ap_dmflip.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-12-18  |  950 b   |  51 lines

  1. /* ap_dmflip.c: flip domains around */
  2.  
  3. # ifndef lint
  4. static char Rcsid[] = "@(#)$Header: /xtel/pp/pp-beta/Lib/addr/RCS/ap_dmflip.c,v 6.0 1991/12/18 20:21:24 jpo Rel $";
  5. # endif
  6.  
  7. /*
  8.  * $Header: /xtel/pp/pp-beta/Lib/addr/RCS/ap_dmflip.c,v 6.0 1991/12/18 20:21:24 jpo Rel $
  9.  *
  10.  * $Log: ap_dmflip.c,v $
  11.  * Revision 6.0  1991/12/18  20:21:24  jpo
  12.  * Release 6.0
  13.  *
  14.  */
  15.  
  16.  
  17.  
  18. #include "util.h"
  19.  
  20.  
  21. /* ---------------------  Begin  Routines  -------------------------------- */
  22.  
  23.  
  24. char *ap_dmflip(buf)
  25. char    *buf;
  26. {
  27.     char            tbuf[LINESIZE];
  28.     char            *cp;
  29.     register char   *p,
  30.             *q;
  31.  
  32.     /* -- don't flip if quoted or dlit -- */
  33.     if (*buf == '"' || *buf == '[')
  34.         return (strdup (buf));
  35.  
  36.     (void) strcpy (tbuf, buf);
  37.  
  38.     cp = smalloc (strlen (buf) + 1);
  39.  
  40.     for(q = cp; (p = rindex (tbuf, '.')) != NULLCP;  *(q-1) = '.') {
  41.         *p++ = 0;
  42.         while((*q++ = *p++) != '\0')
  43.             continue;
  44.     }
  45.  
  46.     p = tbuf;
  47.     while((*q++ = *p++) != '\0')
  48.         continue;
  49.     return (cp);
  50. }
  51.